package xyz.hubery.controller;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.hubery.domain.SysUserLog;
import xyz.hubery.model.R;
import xyz.hubery.service.SysUserLogService;

@RestController
@Api(tags = "用户操作日志记录")
@RequestMapping("/sysUserLog")
public class UserLogController {
    @Autowired
    private SysUserLogService userLogService;

    @GetMapping
    @ApiOperation("分页查询系统日志记录")
    public R<Page<SysUserLog>> queryPage(Page<SysUserLog> page) {
        page.addOrder(OrderItem.desc("created"));
        Page<SysUserLog> userLogPage = userLogService.page(page);
        return R.ok(userLogPage);
    }
}
